package PTA_JAVA.JavaB.Javademo14;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int seed = sc.nextInt();
        ObjectGenerator og=new ObjectGenerator(seed);

        int n = sc.nextInt();
        String[] arr = new String[n];
        ArrayList<String> array = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            Object s=og.getObject();
            arr[i]= s+"";
            if(s instanceof Person){
                array.add(((Person) s).getName());
            }
        }
        System.out.println(Arrays.toString(arr));
        for (int i = 0; i < array.size(); i++) {
            System.out.println("Name of the person is "+array.get(i));
        }
    }
}
class Person{
    private String name;
    private int id;

    public Person(int id, String name) {
        this.id=id;
        this.name=name;
        toString();
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "id="+id+" name='"+name+"'";

    }
}
class ObjectGenerator{
    private Random random;

    public ObjectGenerator(int seed) {
        random = new Random(seed);
    }

    public Object getObject(){
        int choice = random.nextInt(3);
        int x = random.nextInt(26);
        switch (choice) {
            case 0:
                char z = (char)(97+x);
                return new String(""+z);
            case 1:
                return Integer.valueOf(x);
            case 2:
                char name = (char)(65+x);
                return new Person(x, name+"");
        }
        return null;
    }
}

